import fetch from './request.js'

const api = {}
// 验证码
api.verificationCode = params => fetch.requestParams("/api/shop/passport/sendSms", params, "POST", false, false)
// 订单列表  全部
api.orderListAll = params => fetch.request("api/shop/order/order/index", params, "post", false, false)
// 订单列表   其余的
api.orderListPart = params => fetch.request("shop/index/orderStatus", params, "post", true, false)
// 我的
api.myInfo = params => fetch.request("shop/order/mine", params, "post", true, false)
// 登录
api.login = params => fetch.request("user/user/login", params, "post", true, false)
// 搜索
api.search = params => fetch.request("shop/order/search", params, "get", true, false)
// 自提出库单
api.orderDelivery = params => fetch.request("shop/order/delivery", params, "post", true, false)
// 快递出库单
api.courierDelivery = params => fetch.request("shop/order/deliveryExpress", params, "post", true, false)

// 出库商品列表
api.orderDeliveryList = params => fetch.request("shop/index/orderAllInfo", params, "post", true, false)
// 发货快递
api.deliveryCourier = params => fetch.request("shop/order/expressInfo", params, "post", true, false)
// 查看评价
api.seeEvaluation = params => fetch.request("shop/index/check", params, "post", true, false)
// 确认退款
api.confirmRefund = params => fetch.request("shop/index/offline", params, "post", true, false)
// 确认订单
api.confirmOrder = params => fetch.request("api/shop/order/order/confirm", params, "post", false, false)
// 退单
api.singleBack = params => fetch.request("shop/order/orderChargeback", params, "post", true, false)
// 退款
api.refund = params => fetch.request("shop/order/orderRefund", params, "post", true, false)
// 生产部门
api.productionDepartment = params => fetch.request("publicservice/service/department", params, "get", true, false)
api.getBusinessInfo = ()=> fetch.request('api/shop/sales/person/getLoginedShopUser',{},'post',false,false)
// uid  的 user/user/salemenlogin
api.userSalemenlogin = params => fetch.request("user/user/salemenlogin", params, "post", true, false)

//业务员确认退款 /shop/order/pay_refund
api.payRefund = params => fetch.request("shop/order/pay_refund", params, "get", true, false)

// 业务员拒绝退款 /shop/order/refuse_refund
api.refuseRefund = params => fetch.request("shop/order/refuse_refund", params, "get", true, false)

// 业务员退款(定金加尾款) shop/order/pay_refund_all
api.payRefundAll = params => fetch.request("shop/order/pay_refund_all", params, "get", true, false)

// 订单详情 shop/order/orderDetail

api.orderDetail = params => fetch.requestParams("api/shop/order/order/detail", params, "post", false, false)
// 获取二维码 /home/upload/curlToErcode
api.getMark = params => fetch.request("home/upload/curlToErcode", params, "get", true, false)
// 
api.getBase = params => fetch.request("/user/test/test", params, "get", true, false)
api.crateQrCode = params =>  fetch.request("api/shop/user/user/showInvitationCode", params, "POST", false, false)
api.confirmBack = params=> fetch.request("api/shop/order/order/confirm/final", params, "POST", false, false)
api.uploadImage = file =>fetch.upload('api/shop/file/upload/image/v2',file)
api.billConfirm = params=> fetch.request("api/shop/order/order/bill/confirm", params, "POST", false, false)
// 发货详情
api.toDelivery = params => fetch.request("api/shop/order/order/toDelivery", params, "get", true, false)
api.skuList = params => fetch.request("api/shop/product/product/sku/list", params, "get", true, false)
api.deliveryV2 = params=> fetch.request("api/shop/order/order/delivery/v2", params, "POST", false, false)

// 生成订单获取客户
api.userIndex = params=> fetch.request("api/shop/user/user/index", params, "POST", false, false)
// 获取商品 一个规格一条数据
api.productPageSku = params=> fetch.request("api/shop/product/product/pageSku", params, "POST", false, false)
// 获取商品 查询商品选择规格
api.productLists = params=> fetch.request("api/shop/data/product/lists", params, "POST", false, false)
// 获取地址
api.getUserDetail = params=> fetch.request(`api/shop/user/user/detail?userId=${params}`, params, "POST", false, false)
// 门店地址
api.storeIndex = params=> fetch.request(`api/shop/store/store/index`, params, "POST", false, false)
// 修改数量重新计算
api.deliveryCalc = params=> fetch.request(`api/shop/order/order/delivery/calc`, params, "POST", false, false)
// 获取订单下的发货记录
api.deliveryPage = params=> fetch.request(`api/shop/order/delivery/page`, params, "POST", false, false)
// 发货单详情
api.deliveryDetail = params=> fetch.request(`api/shop/order/delivery/detail`, params, "get", true, false)
// 发货审核
api.deliveryAudit = params=> fetch.request(`api/shop/order/delivery/audit`, params, "POST", false, false)
// 计算接口
api.orderModifyCalc = params=> fetch.request(`api/shop/order/order/modify/calc`, params, "POST", false, false)
// 修改保存
api.updateOrderNums = params=> fetch.request(`api/shop/order/order/modify`, params, "POST", false, false)
// 生成订单接口
api.shopUserCreate = params=> fetch.request(`api/shop/order/order/shopUserCreate`, params, "POST", false, false)
// 获取基地
api.produceList = params=> fetch.request(`api/shop/product/product/produce/list`, params, "get", true, false)
// 关闭订单
api.orderClose = params=> fetch.request(`api/shop/order/order/close`, params, "POST", false, false)
export default api

// 处理余额 shop/order/refund_callback/out_trade_no
api.refundCallbackOutTradeNo= params => fetch.request(`shop/order/refund_callback/out_trade_no/${params}`, params, "get", true, false)

//业务员核销核销券
api.writeOffCoupon = params => fetch.requestParams(`api/shop/plus/coupon/coupon/writeOff`, params, "post", true, false)
//手机号登陆
api.phoneLogin = params=> fetch.requestParams(`/api/shop/passport/phoneLogin`, params, "post", true, false)
//业务员退款
api.returnOrder = params=>fetch.request(`api/shop/order/refund/apply`,params,'post',false,false)
//发货时加载数据
api.toDelivery = params=>fetch.requestParams(`api/shop/order/order/toDelivery`,params,'get',true,false)
//确定发货
api.confirmDelivery = params=>fetch.request(`api/shop/order/order/delivery/v2`,params,'post',false,false)
//获取微信配置信息
api.weiXinConfig = params => fetch.request(`weixin/access_token/sign`, params, "get", true, false)
api.weiXinConfigLocal = params => new Promise((resolve, reject) => {
	uni.request({
		url: 'http://192.168.1.110:8081/weixin/access_token/sign',
		data: params,
		header: {
			'content-type': 'application/json',
		},
		method: 'GET', //'GET','POST'
		dataType: 'json',
		success: (res) => {
			res.data.status = '1';
			resolve(res)
		},
		fail: () => {
			reject(0)
		}
	})
})




